<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./assets/scripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.btn_regist').click(function(){
				if( confirm('登録してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			$('.btn_update').click(function(){
				if( confirm('更新してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			$('.btn_return').click(function(){
				location.href = "mmapshop_form.php?mm={{ $forms.map_no }}&ww={{ $forms.matrix_cd }}";
				//mmapshop_form.php?mm=1&ww=2012010
			});
			
			$('.btn_return_index').click(function(){
				location.href = "mmapshop_index.php?hist=2";
			});
			
			$('.sort').change(function(){
				dispMedia();
			});
			/*
			$("#map_no").keyup(function(){
				dispSort();
			});
			*/
		});
		var maparr =[{{$map_arr}}];
		function notExistMap( val ) {
			for ( var i = 0; i < maparr.length; ++i ) {
				if (maparr[i] == val) {
					return false;
				}
			}
			return true;
		}
		/*
		function dispSort() {
			var val = $("#map_no").val();
			
			if (val.length>0 && notExistMap( val )) {
				$('#tr_sort')['show']();
				dispMedia();
			} else {
				$('#tr_sort')['hide']();
				$('#tr_media')['hide']();
			}
		}
		*/
		function dispMedia() {
			var val = $('input[name="sort"]:checked').val();
			if (val == 3) {
					$('#tr_media')['show']();
				} else {
					$('#tr_media')['hide']();
			}
		}
		
		var gPara = "";
		function setS( val ) {
			switch (gPara){
				case "media":
					document.fm.media_name.value = val;
					break;
				default:
					alert("paramater error");
					return ;
					break;
			}
			$('#dialog').dialog("close");
		}
		
		</script>
		
	</head>
	<body id="">
{{ $menu }}
{{ $logout }}
		<div id="container"><div class="wrapper">
			<h2>マップグループマスタ管理</h2>
			 <ul class="submenu clearfix">
				<li><a href="mmapg_index.php">マップグループ情報一覧</a></li>
				<li>マップグループ情報更新</li>
				{{if !$isG7 }}<li><a href="mmapshop_import.php">CSV更新</a></li>{{ /if }}
				<li><a href="mmservice_index.php">サービスマップマスタ</a></li>
			</ul>
			<h3>マップグループ情報{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}{{ if $phase == 'complete' }}完了{{ /if }}</h3>
			
{{ if $phase == 'input' }}
			<p class="message">内容を確認し、{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}ボタンをクリックしてください。</p>
			<form name="fm" action="mmapg_form.php" method="post">
				<table class="formTable">
					<tbody>
{{ if $forms.id != '' }}
						<tr>
							<th>更新日</th>
							<td>
								{{ $forms.u_time }}<input type="hidden" name="u_time" value="{{ $forms.u_time }}" />
							</td>
						</tr>
						<tr>
							<th>更新者</th>
							<td>
								{{ $forms.m_user_name }}<input type="hidden" name="m_user_name" value="{{ $forms.m_user_name }}" />
							</td>
						</tr>
						
{{ /if }}
						<tr><th style="width:160px">週 </th>
							<td>
			{{ $forms.year4 }}年度 &nbsp;  第{{ $forms.week_cd }}周&nbsp; {{ if $forms.week_seq != '0'  }}  第{{ $forms.week_seq }}回&nbsp;  {{ /if }} {{ $forms.flier_date }}
			<input type="hidden" name="matrix_cd" value="{{ $forms.matrix_cd }}" /> 
			<input type="hidden" name="year4" value="{{ $forms.year4 }}" />  <input type="hidden" name="week_cd" value="{{ $forms.week_cd }}" />
			<input type="hidden" name="week_seq" value="{{ $forms.week_seq }}" />  <input type="hidden" name="flier_date" value="{{ $forms.flier_date }}" />
							</td>
						</tr>
						<tr><th style="width:160px"><span>※</span>マップNO </th>
							<td>
{{ if $forms.id != '' }}
<input type="text"  id="map_no" name="map_no" class="dtext" value="{{ $forms.map_no|escape }}" readonly  />{{ $err.map_no }}
{{ else }}
<input type="text"  id="map_no" name="map_no" class="text" value="{{ $forms.map_no|escape }}"   />{{ $err.map_no }}
{{ /if }}
							</td>
						</tr>
						<tr id = "tr_sort" >
							<th style="width:160px"><span>※</span>区分</th>
							<td>
{{ html_radios class='sort' name='sort'  options=$map_sort selected=$forms.sort }}{{ $err.sort }}
							</td>
						</tr>
						<tr id = "tr_media" {{ if ($forms.sort != 3)  }} style="display: none;" {{ /if }}>
							<th><span>※</span>パタ―ン名 </th>
							<td>
{{ html_options id='media_cd' name='media_cd' options=$pattern selected=$forms.media_cd }}{{ $err.media_cd }}
							</td>
						</tr>
					</tbody>
				</table>
				<p class="button">
{{ if $forms.id != '' }}
					<button type="button" class="btn_return" class="submit"><span>戻る</span></button>
					<button type="button" class="btn_update" class="submit"><span>更新</span></button>
{{ else }}
					<button type="button" class="btn_regist" class="submit"><span>登録</span></button>
					<button type="button" class="btn_return_index" class="submit"><span>戻る</span></button>
{{ /if }}
				</p>
				<input type="hidden" name="id" value="{{ $forms.id }}" />
				<input type="hidden" name="mode" value="" />
			</form>
<div id="dialog" >
</div>
 
{{ /if }}

{{ if $phase == 'complete' }}
			<p class="message">{{ $message }}</p>
			<ul>
{{ if $forms.id != '' }}
	<li>>> <a href="mmapshop_form.php?mm={{ $forms.map_no }}&ww={{ $forms.matrix_cd }}">マップグループ情報更新ページに戻る</a></li>
{{ else }}
	<li>>> <a href="mmapshop_index.php?hist=2">マップグループ情報更新一覧ページに戻る</a></li>
{{ /if }}
	<li>>> <a href="mmapg_form.php?week_cd={{ $forms.matrix_cd }}">新規登録</a></li>
{{ if $forms.id != '' }}
	<li>>> <a href="mmapg_form.php?id={{ $forms.id }}&week_cd={{ $forms.matrix_cd }}">更新</a></li>
{{ /if }}
			</ul>
{{ /if }}

		</div></div>
		{{ $footer }}
	</body>
</html>